import 'package:flutter/material.dart';

import 'data.dart';
import 'item_widget.dart';

class Info extends StatelessWidget {
  final bool showTitle;
  final List<InfoItem> dataList;
  const Info({Key key, this.showTitle = false, this.dataList = infoData})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          if (showTitle)
            Container(
              padding: EdgeInsets.all(10),
              alignment: Alignment.centerLeft,
              child: Text(
                '最新资讯',
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
            ),
          Column(
            children: dataList.map((e) {
              return Container(
                // color: Colors.red,
                height: 100,
                margin: EdgeInsets.only(bottom: 10),
                child: ItemWidget(data: e),
              );
            }).toList(),
          )
        ],
      ),
    );
  }
}
